import 'package:flutter/material.dart';

/// 虚线组件
class DashedLine extends StatelessWidget {
  /// 方向
  final Axis axis;

  /// 点宽
  final double dashedWidth;

  /// 点高
  final double dashedHeight;

  /// 点的个数
  final int count;

  /// 点的颜色
  final Color color;

  DashedLine({
    this.axis = Axis.horizontal,
    this.dashedWidth = 5,
    this.dashedHeight = 1,
    this.count = 20,
    this.color = Colors.red,
  });

  @override
  Widget build(BuildContext context) {
    return Flex(
        direction: axis,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: List.generate(
            count,
            (_) => SizedBox(
                  width: dashedWidth,
                  height: dashedHeight,
                  child: DecoratedBox(
                    decoration: BoxDecoration(color: color),
                  ),
                )));
  }
}
